home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-PPC / PROCESSO.{_I < prev    next >
Text File  |  1999-09-17  |  10KB  |  352 lines

  1. #ifndef __ASM_PPC_PROCESSOR_H
  2. #define __ASM_PPC_PROCESSOR_H
  3.  
  4. #include <linux/config.h>
  5.  
  6. #include <asm/ptrace.h>
  7. #include <asm/residual.h>
  8.  
  9. /* Bit encodings for Machine State Register (MSR) */
  10. #define MSR_POW        (1<<18)        /* Enable Power Management */
  11. #define MSR_TGPR    (1<<17)        /* TLB Update registers in use */
  12. #define MSR_ILE        (1<<16)        /* Interrupt Little-Endian enable */
  13. #define MSR_EE        (1<<15)        /* External Interrupt enable */
  14. #define MSR_PR        (1<<14)        /* Supervisor/User privilege */
  15. #define MSR_FP        (1<<13)        /* Floating Point enable */
  16. #define MSR_ME        (1<<12)        /* Machine Check enable */
  17. #define MSR_FE0        (1<<11)        /* Floating Exception mode 0 */
  18. #define MSR_SE        (1<<10)        /* Single Step */
  19. #define MSR_BE        (1<<9)        /* Branch Trace */
  20. #define MSR_FE1        (1<<8)        /* Floating Exception mode 1 */
  21. #define MSR_IP        (1<<6)        /* Exception prefix 0x000/0xFFF */
  22. #define MSR_IR        (1<<5)        /* Instruction MMU enable */
  23. #define MSR_DR        (1<<4)        /* Data MMU enable */
  24. #define MSR_RI        (1<<1)        /* Recoverable Exception */
  25. #define MSR_LE        (1<<0)        /* Little-Endian enable */
  26.  
  27. #ifdef CONFIG_APUS
  28. #define MSR_        MSR_ME|MSR_IP|MSR_RI
  29. #else
  30. #define MSR_        MSR_ME|MSR_RI
  31. #endif
  32. #define MSR_KERNEL      MSR_|MSR_IR|MSR_DR
  33. #define MSR_USER    MSR_KERNEL|MSR_PR|MSR_EE
  34.  
  35. /* Bit encodings for Hardware Implementation Register (HID0)
  36.    on PowerPC 603, 604, etc. processors (not 601). */
  37. #define HID0_EMCP    (1<<31)        /* Enable Machine Check pin */
  38. #define HID0_EBA    (1<<29)        /* Enable Bus Address Parity */
  39. #define HID0_EBD    (1<<28)        /* Enable Bus Data Parity */
  40. #define HID0_SBCLK    (1<<27)
  41. #define HID0_EICE    (1<<26)
  42. #define HID0_ECLK    (1<<25)
  43. #define HID0_PAR    (1<<24)
  44. #define HID0_DOZE    (1<<23)
  45. #define HID0_NAP    (1<<22)
  46. #define HID0_SLEEP    (1<<21)
  47. #define HID0_DPM    (1<<20)
  48. #define HID0_ICE    (1<<15)        /* Instruction Cache Enable */
  49. #define HID0_DCE    (1<<14)        /* Data Cache Enable */
  50. #define HID0_ILOCK    (1<<13)        /* Instruction Cache Lock */
  51. #define HID0_DLOCK    (1<<12)        /* Data Cache Lock */
  52. #define HID0_ICFI    (1<<11)        /* Instruction Cache Flash Invalidate */
  53. #define HID0_DCI    (1<<10)        /* Data Cache Invalidate */
  54. #define HID0_SIED    (1<<7)        /* Serial Instruction Execution [Disable] */
  55. #define HID0_BHTE    (1<<2)        /* Branch History Table Enable */
  56. #define HID0_BTCD    (1<<1)        /* Branch target cache disable */
  57.  
  58. /* fpscr settings */
  59. #define FPSCR_FX        (1<<31)
  60. #define FPSCR_FEX       (1<<30)
  61.  
  62. #define _MACH_prep     1
  63. #define _MACH_Pmac     2  /* pmac or pmac clone (non-chrp) */
  64. #define _MACH_chrp     4  /* chrp machine */
  65. #define _MACH_mbx      8  /* Motorola MBX board */
  66. #define _MACH_apus    16  /* amiga with phase5 powerup */
  67. #define _MACH_fads    32  /* Motorola FADS board */
  68. #define _MACH_rpxlite 64  /* RPCG RPX-Lite 8xx board */
  69. #define _MACH_bseip   128 /* Bright Star Engineering ip-Engine */
  70. #define _MACH_yk      256 /* Motorola Yellowknife */
  71.  
  72. /* see residual.h for these */
  73. #define _PREP_Motorola 0x01  /* motorola prep */
  74. #define _PREP_Firm     0x02  /* firmworks prep */
  75. #define _PREP_IBM      0x00  /* ibm prep */
  76. #define _PREP_Bull     0x03  /* bull prep */
  77. #define _PREP_Radstone 0x04  /* Radstone Technology PLC prep */
  78.  
  79. /*
  80.  * Radstone board types
  81.  */
  82. #define RS_SYS_TYPE_PPC1   0
  83. #define RS_SYS_TYPE_PPC2   1
  84. #define RS_SYS_TYPE_PPC1a  2
  85. #define RS_SYS_TYPE_PPC2a  3
  86. #define RS_SYS_TYPE_PPC4   4
  87. #define RS_SYS_TYPE_PPC4a  5
  88. #define RS_SYS_TYPE_PPC2ep 6
  89.  
  90. /* these are arbitrary */
  91. #define _CHRP_Motorola 0x04  /* motorola chrp, the cobra */
  92. #define _CHRP_IBM      0x05  /* IBM chrp, the longtrail and longtrail 2 */
  93.  
  94. #define _GLOBAL(n)\
  95.     .globl n;\
  96. n:
  97.  
  98. #define    TBRU    269    /* Time base Upper/Lower (Reading) */
  99. #define    TBRL    268
  100. #define TBWU    284    /* Time base Upper/Lower (Writing) */
  101. #define TBWL    285
  102. #define    XER    1
  103. #define LR    8
  104. #define CTR    9
  105. #define HID0    1008    /* Hardware Implementation */
  106. #define PVR    287    /* Processor Version */
  107. #define IBAT0U    528    /* Instruction BAT #0 Upper/Lower */
  108. #define IBAT0L    529
  109. #define IBAT1U    530    /* Instruction BAT #1 Upper/Lower */
  110. #define IBAT1L    531
  111. #define IBAT2U    532    /* Instruction BAT #2 Upper/Lower */
  112. #define IBAT2L    533
  113. #define IBAT3U    534    /* Instruction BAT #3 Upper/Lower */
  114. #define IBAT3L    535
  115. #define DBAT0U    536    /* Data BAT #0 Upper/Lower */
  116. #define DBAT0L    537
  117. #define DBAT1U    538    /* Data BAT #1 Upper/Lower */
  118. #define DBAT1L    539
  119. #define DBAT2U    540    /* Data BAT #2 Upper/Lower */
  120. #define DBAT2L    541
  121. #define DBAT3U    542    /* Data BAT #3 Upper/Lower */
  122. #define DBAT3L    543
  123. #define DMISS    976    /* TLB Lookup/Refresh registers */
  124. #define DCMP    977
  125. #define HASH1    978
  126. #define HASH2    979
  127. #define IMISS    980
  128. #define ICMP    981
  129. #define RPA    982
  130. #define SDR1    25    /* MMU hash base register */
  131. #define DAR    19    /* Data Address Register */
  132. #define SPR0    272    /* Supervisor Private Registers */
  133. #define SPRG0   272
  134. #define SPR1    273
  135. #define SPRG1   273
  136. #define SPR2    274
  137. #define SPRG2   274
  138. #define SPR3    275
  139. #define SPRG3   275
  140. #define DSISR    18
  141. #define SRR0    26    /* Saved Registers (exception) */
  142. #define SRR1    27
  143. #define IABR    1010    /* Instruction Address Breakpoint */
  144. #define DEC    22    /* Decrementer */
  145. #define EAR    282    /* External Address Register */
  146. #define L2CR    1017    /* PPC 750 L2 control register */
  147.  
  148. #define THRM1    1020
  149. #define THRM2    1021
  150. #define THRM3    1022
  151. #define THRM1_TIN 0x1
  152. #define THRM1_TIV 0x2
  153. #define THRM1_THRES (0x7f<<2)
  154. #define THRM1_TID (1<<29)
  155. #define THRM1_TIE (1<<30)
  156. #define THRM1_V   (1<<31)
  157. #define THRM3_E   (1<<31)
  158.  
  159. /* Segment Registers */
  160. #define SR0    0
  161. #define SR1    1
  162. #define SR2    2
  163. #define SR3    3
  164. #define SR4    4
  165. #define SR5    5
  166. #define SR6    6
  167. #define SR7    7
  168. #define SR8    8
  169. #define SR9    9
  170. #define SR10    10
  171. #define SR11    11
  172. #define SR12    12
  173. #define SR13    13
  174. #define SR14    14
  175. #define SR15    15
  176.  
  177. #ifndef __ASSEMBLY__
  178. /*
  179.  * If we've configured for a specific machine set things
  180.  * up so the compiler can optimize away the other parts.
  181.  * -- Cort
  182.  */
  183. #ifdef CONFIG_MACH_SPECIFIC
  184. #ifdef CONFIG_PREP
  185. #define _machine (_MACH_prep)
  186. #define is_prep (1)
  187. #define is_chrp (0)
  188. #define have_of (0)
  189. #endif /* CONFIG_PREP */
  190.  
  191. #ifdef CONFIG_CHRP
  192. #define _machine (_MACH_chrp)
  193. #define is_prep (0)
  194. #define is_chrp (1)
  195. #define have_of (1)
  196. #endif /* CONFIG_CHRP */
  197.  
  198. #ifdef CONFIG_PMAC
  199. #define _machine (_MACH_Pmac)
  200. #define is_prep (0)
  201. #define is_chrp (0)
  202. #define have_of (1)
  203. #endif /* CONFIG_PMAC */
  204.  
  205. #ifdef CONFIG_MBX
  206. #define _machine (_MACH_mbx)
  207. #define is_prep (0)
  208. #define is_chrp (0)
  209. #define have_of (0)
  210. #endif /* CONFIG_MBX */
  211.  
  212. #ifdef CONFIG_FADS
  213. #define _machine (_MACH_fads)
  214. #define is_prep (0)
  215. #define is_chrp (0)
  216. #define have_of (0)
  217. #endif /* CONFIG_FADS */
  218.  
  219. #ifdef CONFIG_APUS
  220. #define _machine (_MACH_apus)
  221. #define is_prep (0)
  222. #define is_chrp (0)
  223. #define have_of (0)
  224. #endif /* CONFIG_APUS */
  225.  
  226. #else /* CONFIG_MACH_SPECIFIC */
  227.  
  228. extern int _machine;
  229.  
  230. /* if we're a prep machine */
  231. #define is_prep (_machine == _MACH_prep)
  232.  
  233. /* if we're a chrp machine */
  234. #define is_chrp (_machine == _MACH_chrp)
  235.  
  236. /* if we have openfirmware */
  237. extern unsigned long have_of;
  238. #endif /* CONFIG_MACH_SPECIFIC */
  239.  
  240. /* what kind of prep workstation we are */
  241. extern int _prep_type;
  242. /*
  243.  * This is used to identify the board type from a given PReP board
  244.  * vendor. Board revision is also made available.
  245.  */
  246. extern unsigned char ucSystemType;
  247. extern unsigned char ucBoardRev;
  248. extern unsigned char ucBoardRevMaj, ucBoardRevMin;
  249.  
  250. struct task_struct;
  251. void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp);
  252. void release_thread(struct task_struct *);
  253.  
  254. /*
  255.  * Bus types
  256.  */
  257. #define EISA_bus 0
  258. #define EISA_bus__is_a_macro /* for versions in ksyms.c */
  259. #define MCA_bus 0
  260. #define MCA_bus__is_a_macro /* for versions in ksyms.c */
  261.  
  262. /* Lazy FPU handling on uni-processor */
  263. extern struct task_struct *last_task_used_math;
  264.  
  265. /*
  266.  * this is the minimum allowable io space due to the location
  267.  * of the io areas on prep (first one at 0x80000000) but
  268.  * as soon as I get around to remapping the io areas with the BATs
  269.  * to match the mac we can raise this. -- Cort
  270.  */
  271. #define TASK_SIZE    (0x80000000UL)
  272.  
  273. /* This decides where the kernel will search for a free chunk of vm
  274.  * space during mmap's.
  275.  */
  276. #define TASK_UNMAPPED_BASE    (TASK_SIZE / 8 * 3)
  277.  
  278. typedef struct {
  279.     unsigned long seg;
  280. } mm_segment_t;
  281.  
  282. struct thread_struct {
  283.     unsigned long    ksp;        /* Kernel stack pointer */
  284.     unsigned long    *pg_tables;    /* Base of page-table tree */
  285.     unsigned long    wchan;        /* Event task is sleeping on */
  286.     struct pt_regs    *regs;        /* Pointer to saved register state */
  287.     mm_segment_t    fs;        /* for get_fs() validation */
  288.     signed long     last_syscall;
  289.     double        fpr[32];    /* Complete floating point set */
  290.     unsigned long    fpscr_pad;    /* fpr ... fpscr must be contiguous */
  291.     unsigned long    fpscr;        /* Floating point status */
  292.     unsigned long    smp_fork_ret;
  293. };
  294.  
  295. #define INIT_SP        (sizeof(init_stack) + (unsigned long) &init_stack)
  296.  
  297. #define INIT_TSS  { \
  298.     INIT_SP, /* ksp */ \
  299.     (unsigned long *) swapper_pg_dir, /* pg_tables */ \
  300.     0, /* wchan */ \
  301.     (struct pt_regs *)INIT_SP - 1, /* regs */ \
  302.     KERNEL_DS, /*fs*/ \
  303.     0, /* last_syscall */ \
  304.     {0}, 0, 0, 0 \
  305. }
  306.  
  307. /*
  308.  * Note: the vm_start and vm_end fields here should *not*
  309.  * be in kernel space.  (Could vm_end == vm_start perhaps?)
  310.  */
  311. #define INIT_MMAP { &init_mm, 0, 0x1000, NULL, \
  312.             PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, \
  313.             1, NULL, NULL }
  314.  
  315. /*
  316.  * Return saved PC of a blocked thread. For now, this is the "user" PC
  317.  */
  318. static inline unsigned long thread_saved_pc(struct thread_struct *t)
  319. {
  320.     return (t->regs) ? t->regs->nip : 0;
  321. }
  322.  
  323. #define copy_segments(nr, tsk, mm)    do { } while (0)
  324. #define release_segments(mm)        do { } while (0)
  325. #define forget_segments()        do { } while (0)
  326.  
  327. /*
  328.  * NOTE! The task struct and the stack go together
  329.  */
  330. #define alloc_task_struct() \
  331.     ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
  332. #define free_task_struct(p)    free_pages((unsigned long)(p),1)
  333.  
  334. /* in process.c - for early bootup debug -- Cort */
  335. int ll_printk(const char *, ...);
  336. void ll_puts(const char *);
  337.  
  338. #define init_task    (init_task_union.task)
  339. #define init_stack    (init_task_union.stack)
  340.  
  341. #endif /* ndef ASSEMBLY*/
  342.  
  343.   
  344. #endif /* __ASM_PPC_PROCESSOR_H */
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.